package edu.cuc.socket.url.url;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Scanner;

public class URLDemo {
    public static void main(String[] args) throws IOException {
        URL url = new URL("http", "news.ifeng.com", 80, "/a/20171217/54244432_0.shtml");
        InputStream inputStream = url.openStream();
        Scanner scanner = new Scanner(inputStream);
        scanner.useDelimiter("\n");
        while (scanner.hasNext()) {
            System.out.println(scanner.next());
        }
    }
}
